<template>
  <el-form :model="form">
    <el-from-item>
      <el-table :data="form.stations" align="center" stripe style="width: 100%">
        <el-table-column prop="id" label="充电桩编号" width="100"/>
        <el-table-column prop="type" label="充电模式" width="100"/>
        <el-table-column prop="is_on" label="充电桩状态" width="100"/>
        <el-table-column prop="is_serve" label="是否忙碌" width="100"/>
        <el-table-column prop="serves" label="启动后服务次数" width="130"/>
        <el-table-column prop="time_finish" label="启动后充电时长(分钟)" width="130"/>
        <el-table-column prop="power_finish" label="充电总电量(度)" width="100"/>
        <el-table-column prop="serve_id" label="当前订单号" width="100"/>
      </el-table>
    </el-from-item>

    <el-form-item>
      <el-button type="primary" @click="onSubmit">更新状态</el-button>
    </el-form-item>
  </el-form>

</template>

<script>
import axios from 'axios';

export default {
  name: 'ViewCurrentState',
  tabel: [],
  data() {
    return {
      form: {
        num: -1,
        stations_list: [],
      },
    };
  },
  methods: {
    onSubmit() {
      console.log(this.form);
      const path = '/api/admin/stations_list';
      axios.get(path)
        .then((res) => {
          this.form = res.data;
        })
        .catch((error) => {
          console.error(error);
        });
    },
  },
};
</script>

<style>
</style>
